<template>
	<view class="">

		<view class="u-flex u-row-between bg_FFFFFF u-p-20">
			<view class="u-h-100">
				<view class="u-m-t-30" style="border-left: 10rpx solid red;padding-left: 30rpx;">
					历史转赠
				</view>
			</view>

			<view class="u-b-r-14 u-flex u-row-between" style="border: 1rpx solid #FF5502; padding: 10rpx;"
				@click="show=true">
				<view class="u-flex">
					<u-image src='https://www.sqkjkj.vip/wxImg/mybag/img1.png' width='28rpx' height='28rpx'></u-image>
					<view class="u-m-l-10 u-font-28" style="padding-right: 20rpx;">
						{{params.s_time==''?'请选择时间':`${params.s_time}-${params.e_time}`}}</view>
				</view>

				<u-icon name="arrow-down"></u-icon>
			</view>
		</view>
		<view class="u-p-20">
			<view class=" u-p-20 u-b-r-16 ">
				<view class=" u-p-b-20 u-flex u-row-between" style="border-bottom: 1rpx solid  #F1F2F6;"
					v-for='(item,index) in list' :key="item.id">
					<view class="">
						<view class="">{{item.mobile}}</view>
						<view class="u-font-20 u-m-t-20" style="color: #A5A6AC;">
							{{$u.timeFormat(item.create_time, 'yyyy-mm-dd hh:MM:ss')}}
						</view>
					</view>
					<view class="u-weight" style="color:#454545;">￥{{item.num}}</view>

				</view>
				<!-- 加载更多 -->
				<u-loadmore :status="status" icon-type="circle" margin-top="20" margin-bottom="20" />
			</view>
		</view>
		<!-- 日历窗口 -->
		<u-calendar v-model="show" :mode="mode" @change='change'></u-calendar>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				params: {
					page: 1,
					page_size: 10,
					s_time: '',
					e_time: '',
					type: 'deposit'
				},
				list: [],
				show: false,
				mode: 'range',
				status: 'loadmore',
			}
		},
		onShow() {
			this.clear()
			this.massage()
		},
		// 下拉到底事件
		onReachBottom() {
			//避免多次触发
			if (this.status == 'loading' || this.status == 'nomore') {
				return;
			}
			this.massage();
		},
		methods: {
			clear() {
				this.list = [];
				this.params.page = 1;
			},
			massage() {
				this.$api.my_score_give_list(this.params, res => {
					if (res.data.code == 1) {
						if (res.data.data.data.length < 20) {
							this.status = 'nomore';
						} else {
							this.params.page = this.params.page + 1;
							this.status = 'loadmore';
						}
						this.list = this.list.concat(res.data.data.data);
						uni.stopPullDownRefresh();
					}
				})
			},
			change(e) {
				this.params.s_time = e.startDate
				this.params.e_time = e.endDate
				this.clear()
				this.massage()
			}

		}
	}
</script>

<style scoped>
	
</style>
